import React, { Component } from 'react'
import AddCount from './AddCount'
import SubCount from './SubCount'
export class App extends Component {
  constructor(props) {
    super(props)
    this.state = {
      count: 100
    }
  }
  changeCount(count){
    this.setState({
      count: this.state.count + count
    })
  }
  render() {
    const { count } = this.state
    return (
      <div className="app">
        当前计数： {count}
        <AddCount count={count} addClick={(count) => this.changeCount(count)} />
        <SubCount count={count} addClick={(count) => this.changeCount(count)} />
      </div>
    )
  }
}

export default App